﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using UmbracoMVCDemo.Models.Masters;
using Umbraco.Web;

namespace UmbracoMVCDemo.Controllers.Masters
{
    public class MasterTextPageController : MasterDocTypeController
    {
        protected ViewResult View(MasterTextPageModel model)
        {
            return this.View(null, model);
        }

        protected ViewResult View(string view, MasterTextPageModel model)
        {
            model.BodyText = CurrentPage.GetPropertyValue<IHtmlString>("bodyText");

            // For some reason, IHtmlString as type parameter, does not work on simple editors:
            model.IntroText = new HtmlString(CurrentPage.GetPropertyValue<string>("introText"));

            return base.View(view, model);
        }
    }
}
